package com.rainwen.el;

import java.text.MessageFormat;
import java.util.ResourceBundle;

public final class MessageFactory
{
  protected static final ResourceBundle bundle = ResourceBundle.getBundle("org.apache.el.Messages");
  
  public static String get(String key)
  {
    return bundle.getString(key);
  }
  
  public static String get(String key, Object... args)
  {
    String value = get(key);
    if (value == null) {
      value = key;
    }
    MessageFormat mf = new MessageFormat(value);
    return mf.format(args, new StringBuffer(), null).toString();
  }
}
